//
//  SelectLanguageCell.swift
//  SCA
//
//  Created by tjun on 2025/9/6.
//

import UIKit


class SelectLanguageModel {
    let title: String
    var isSelected: Bool
    let language: AppLanguage
    
    init(title: String, language: AppLanguage, isSelected: Bool = false) {
        self.title = title
        self.language = language
        self.isSelected = isSelected
    }
}

class SelectLanguageCell: BaseTableViewCell {
    
    var model: SelectLanguageModel! {
        didSet {
            titleLabel.text = model.title
            containerView.backgroundColor = model.isSelected ? UIColorMake(0x0088F3) : .clear
        }
    }

    private let titleLabel = UILabel(font: UIFontMake(16), textColor: .white)
    private let containerView = UIView()
    
    override func setSubView() {
        super.setSubView()

        
        selectionStyle = .none
        
        backgroundColor = UIColorMake(0x2E3036)
        containerView.addCorner(radius: 12)
        contentView.addSubview(containerView)
        containerView.snp.makeConstraints { make in
            make.left.right.equalToSuperview().inset(10)
            make.top.bottom.equalToSuperview()
        }
        
        containerView.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { (make) in
            make.left.equalTo(12)
            make.centerY.equalToSuperview()
        }
  
    }

}
